package com.example.serviceorder.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 购物车服务Feign客户端
 * 用于调用service-product服务的购物车相关接口
 */
@FeignClient(name = "service-product")
public interface CartClient {
    @GetMapping("/cart/{userId}")
    Object getCart(@PathVariable("userId") Long userId);

    @GetMapping("/cart/{userId}/items")
    List<Object> getCartItems(@PathVariable("userId") Long userId);

    @PostMapping("/cart/{userId}/add")
    Object addItem(@PathVariable("userId") Long userId, @RequestParam("productId") Long productId, @RequestParam("quantity") Integer quantity);

    @PostMapping("/cart/{userId}/update")
    Object updateItem(@PathVariable("userId") Long userId, @RequestParam("productId") Long productId, @RequestParam("quantity") Integer quantity);

    @PostMapping("/cart/{userId}/remove")
    Object removeItem(@PathVariable("userId") Long userId, @RequestParam("productId") Long productId);

    @PostMapping("/cart/{userId}/clear")
    void clearCart(@PathVariable("userId") Long userId);

    /**
     * 调用产品服务生成订单号
     *
     * @return 订单号
     */
    @GetMapping("/cart/generate-order-no")
    String generateOrderNo();
} 